{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">手机号码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_phone"   lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">密码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_password"   lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户昵称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_username"  lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">真实姓名：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_real_name"   lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户头像</label>
                            <input type="hidden" name="user_image" id="lay-img" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">身份证号码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_card"   lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">身份证正面</label>
                            <input type="hidden" name="user_z_card_img" id="lay-img1" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload1">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list1">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">身份证反面</label>
                            <input type="hidden" name="user_f_card_img" id="lay-img2" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload2">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list2">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">营业执照</label>
                            <input type="hidden" name="user_yyzz" id="lay-img3" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload3">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list3">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">公司名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_company_name"   lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-top:50px">
                            <label class="layui-form-label">公司地址:</label>
                            <div class="layui-input-block">
                                <div id="container" style='width:90%;height:400px;z-index: 100;'></div>
                                <div id="myPageTop" style="margin-left: 150px;margin-top:10px;z-index:1000" >
                                    <table>
                                        <tr>
                                            <td>
                                                <label>请输入搜索内容</label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="tipinput" class="dingwei" style="position: absolute;top: 0;right: -120px" placeholder="请输入地址"/>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">定位的地址:</label>
                            <div class="layui-input-block">
                                <table style="border-collapse:separate; border-spacing:5px;">
                                    <tr>
                                        <td>
                                            <input type="text" name="match_addr" class="match_addr" style="height:30px;width:500px" placeholder="详情地址" value=""/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input type="text" readonly name="match_lon" class="match_lon" style="height:30px" placeholder="经度" value=""/>
                                        </td>
                                        <td>
                                            <input type="text" readonly name="match_lat" class="match_lat" style="margin-left:-250px;height:30px" placeholder="纬度" value=""/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">添加
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=1e0d12c4fc7710d9c326e672ac6f26c2&plugin=AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocode"></script>
<!--比赛地址-->
<script type="text/javascript">
    var map = new AMap.Map("container", {
        resizeEnable: true
    });
    var autoOptions = {
        input: "tipinput"
    };
    var auto = new AMap.Autocomplete(autoOptions);
    var placeSearch = new AMap.PlaceSearch({
        map: map
    });
    AMap.event.addListener(auto, "select", select);
    function select(e) {
        placeSearch.setCity(e.poi.adcode);
        placeSearch.search(e.poi.name);
        var lng = e.poi.location.lng;   //获取经度
        var lat = e.poi.location.lat;   //获取纬度
        var address = e.poi.district+e.poi.name;   //获取纬度
        $('input[name=match_addr]').val(address);
        $('input[name=match_lon]').val(lng);
        $('input[name=match_lat]').val(lat);
    }
    AMap.event.addListener(placeSearch, "markerClick", addasd);

    function addasd(e) {
        $('input[name=match_addr]').val(e.data.pname+e.data.cityname+e.data.adname+e.data.name);
        $('input[name=match_lon]').val(e.data.location.lng);
        $('input[name=match_lat]').val(e.data.location.lat);
    }
</script>
<script>
    var editor = wk.wang({elem:'#LAY_editor'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    wk.uploadImg1({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    wk.uploadImg2({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    wk.uploadImg3({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
//        form.verify({
//            editor:function(value,item){
//                if(editor.txt.html() == '<p><br></p>'){
//                    return '请填写内容';
//                }
//            }
//        });
        form.on('submit(component-form-element)', function (data) {
            data.field.banner_content = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('add')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('member2/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });

    });
</script>

</body>
</html>
